class htmlGen:
	def __init__(self,_app):
		self.app=_app
	
	def htmlLayout(self,L,bckgrnd=""):
		'''make a layout for tha full description o an entry'''
		A=('<HTML>\
			<BODY style="background-image:url('+str(bckgrnd)+');background-repeat:no-repeat;" >\
			<BR><BR>')
		if len(L)>=2:   
			A+=('<CENTER><h1><B><BIG>'+str(L[0])+' - '+str(L[1])+'</BIG></B></h1></CENTER>')
		if len(L)>=3:
			A+=('<BR><BR><BR><BR>\
			<CENTER><IMG SRC='+str(L[2])+'></CENTER>')
		if len(L)>=4:
			A+=('<BR><BR><BR><BR>\
			<p>'+ str(L[3])+ '</p>')
		if len(L)>=5:
			A+=('<BR><BR><BR><BR><h2>Artist Information:</h2><BR><p>'+str(L[4])+'</p>')
		if len(L)>=6:
			for i in L[5:]:
				A+='<br><br><p>'+i+'</p>'
	
		A+='</body>'
		return A
	
	def generateHtmlSource(self,ls):
			'''this func gets form the table the lines and prints them out one by one as links'''
			i=0
			src=""
			tmp=self.app.table.getRowData(i)
			while tmp!=None:
				src+='<a href="'+' '.join([str(tmp[x]) for x in ls])+'">'
				for j in ls:
					src+=tmp[j]+", "
				src+="</a><br/>"
				i+=1
				tmp=self.app.table.getRowData(i)
			return src
